// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   address_delete_ok.java

package stock.config.stock;

import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.sql.ResultSet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class address_delete_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;

	public address_delete_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);
		try
		{
			if (stock_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String stock_ID = request.getParameter("stock_ID");
				String sql1 = (new StringBuilder("select stock_ID from stock_cell_details where stock_ID='")).append(stock_ID).append("'").toString();
				ResultSet rs1 = stock_db.executeQuery(sql1);
				if (rs1.next())
				{
					response.sendRedirect("stock/config/stock/address_delete_ok_a.jsp");
				} else
				{
					String sql = (new StringBuilder("delete from stock_config_public_char where stock_ID='")).append(stock_ID).append("'").toString();
					stock_db.executeUpdate(sql);
					response.sendRedirect("stock/config/stock/address.jsp");
				}
				stock_db.commit();
				stock_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
